home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
050a.dms
/
050a.adf
/
TEXTS
/
chapter22.txt
< prev
next >
Wrap
Text File
|
1992-02-26
|
2KB
|
49 lines
The Absolute Beginners Guide To Amos
-------------------------------------
Chapter Twenty Two
-------------------
I hope you suceeded in solving the project I set you in chapter 21.
In case you didn't or would like to check out my solution here it is:
REM Example22.Amos (A possible solution)
Hide On
Unpack 10 To 3
Repeat
If Jleft(1) Then Shift Up 1,1,31,1
If Jright(1) Then Shift Down 1,1,31,1
If Fire(1) Then Shift Off
Until Mouse Key
Default
Edit
First I loaded the starfield routine in Example21.Amos. and edited the code
to appear as above.
After unpacking the screen from bank 10 we hit a brand new command, REPEAT.
This is only half of a command really as it's called a REPEAT UNTIL loop.
It's just like a DO LOOP structure, remember that? What REPEAT UNTIL does
is it REPEATedly executes the instructions between the REPEAT and the UNTIL
commands. The UNTIL needs a condition attached to it. In this case I have
decided that the code will be REPEATed UNTIL a MOUSE KEY has been pressed.
I could have put UNTIL INKEY$<>"" (any key press) or UNTIL JUP(1)
(joystick pushed up) etc.
So basically Amos will be looping between the REPEAT UNTIL commands until
either a MOUSE KEY is pressed or the JRIGHT, JLEFT or FIRE commands are true.
If the joystick is pushed to the left we set the SHIFT UP command in action
which starts the stars moving. The opposite applies for JRIGHT.
I have also added the FIRE button to the loop which stops the stars in their
tracks. Not bad for a few lines!
The source code to Project 1 can be found in the PROJECTS drawer on this
disk.
I think we have spent long enough on the SHIFT command, fun though it is.
Please feel free to experiment further, there are lots of tricks that can be
done. So get out Dpaint and see what you can do.
End of Chapter 22
^^^^^^^^^^^^^^^^^